package com.xy.adapter.springmvc;

///定义一个Adapter接口 
public interface HandlerAdapter {
	public boolean support(Controller handler);

	public void handle(Controller handler);
}

// 多种适配器类
class SimpleHandlerAdapter implements HandlerAdapter {

	public void handle(Controller handler) {
		 handler.doHandler();
	}

	public boolean support(Controller handler) {
		return (handler instanceof SimpleController);
	}

}

class HttpHandlerAdapter implements HandlerAdapter {

	public void handle(Controller handler) {
		handler.doHandler();
	}

	public boolean support(Controller handler) {
		return (handler instanceof HttpController);
	}

}

class AnnotationHandlerAdapter implements HandlerAdapter {

	public void handle(Controller handler) {
		handler.doHandler();
	}

	public boolean support(Controller handler) {

		return (handler instanceof AnnotationController);
	}

}